package com.lanmao.mall.exception;

import com.lanmao.mall.enums.StatusCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义业务异常，用于处理用户请求时，业务错误时抛出
 *
 * @author lanmao
 * @date 2023/11/25
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException {

    private final StatusCode statusCode;

    public BusinessException(StatusCode statusCode) {
        super(statusCode.getMessage(), null, false, false);
        this.statusCode = statusCode;
    }

}
